package api

import (
	"pd/modules"
	"pd/modules/allowed_sign"

	"github.com/gin-gonic/gin"
)

var handler = &Handler{}

// allowed_sign的http实例，会实现gin的http Handler
type Handler struct {
	svc allowed_sign.Service
}

// Deprecated: Use GinConfig and init 
func NewAsHttpHandler(svc allowed_sign.Service) *Handler {
	return &Handler{
		svc: svc,
	}
}

func (h *Handler) GinRegistry(r gin.IRouter) {
	r.POST("/allowed_sign/name", h.createAllowed_sign)
}

func (h *Handler) GinConfig() {
	h.svc = modules.GetImpl(allowed_sign.AppName).(allowed_sign.Service)
}

func (h *Handler) GinName() string {
	return allowed_sign.AppName
}

func init() {
	modules.RegistryGins(handler)
}

